#ifndef __DPS_DRAMADDRDEF_H__
#define __DPS_DRAMADDRDEF_H__
#include "sidcfunc.h"
#include "Dos32.h"

#define K_DPS_ADDR_Start 				K_SDRAM_DPSStartAddr
#define K_DPS_ADDR_End					(K_DPS_ADDR_TempBuf)

#define K_DPS_ADDR_Size					((K_DPS_ADDR_End - K_DPS_ADDR_Start)<<1)

//io buf
#define K_DPS_ADDR_InData_Container_Size		(12ul)
#define K_DPS_ADDR_InData_Size			(1024UL*8UL)
#define K_DPS_ADDR_OutData_Size		(1024UL*2UL)
//file node buf
#define K_DPS_ADDR_FileNode_Size 		((UINT32)SIDC_FILE_NODE_SIZE)
//print set buf
#define K_DPS_ADDR_ConfigStartJob_Size	((UINT32)DPS_PARA_ConfigStartJob_Size)
#define K_DPS_ADDR_ConfigPrintInfo_Size	(((UINT32)DPS_PARA_ConfigPrintInfo_Size_Min)*(UINT32)DPS_PARA_ConfigPrintInfoMaxCount +(UINT32)4UL)
//status save buf
#define K_DPS_ADDR_DeviceStatus_Size 		((UINT32)DPS_PARA_DeviceStatus_Size)
#define K_DPS_ADDR_JobStatus_Size 			((UINT32)DPS_PARA_JobStatus_Size)
#define K_DPS_ADDR_ConfigPrintService_Size 	((UINT32)DPS_PARA_ConfigPrintService_Size)
#define K_DPS_ADDR_Capatility_Size 			((UINT32)DPS_PARA_Capability_Elem_Size*10UL)
#define K_DPS_ADDR_Capatility_Item_Size		((UINT32)DPS_PARA_Capability_Elem_Size)
//#define K_DPS_ADDR_Capatility_ItemArray_Size		(DPS_PARA_Capability_ElemArray_Size)
//////////////////////////////
//indispensable dram buf

//io buf
#define K_DPS_ADDR_InData 		K_DPS_ADDR_Start
#define K_DPS_ADDR_OutData 	(K_DPS_ADDR_InData +  (K_DPS_ADDR_InData_Size>>1))
//file node buf
#define K_DPS_ADDR_FileNode 	(K_DPS_ADDR_OutData +  (K_DPS_ADDR_OutData_Size>>1))
//print set buf
#define K_DPS_ADDR_ConfigStartJob 		(K_DPS_ADDR_FileNode +  (K_DPS_ADDR_FileNode_Size>>1))
	//UINT16 count;UINT16 index;DPS_PARA_ConfigPrintInfo data;
#define K_DPS_ADDR_ConfigPrintInfo 		(K_DPS_ADDR_ConfigStartJob +  (K_DPS_ADDR_ConfigStartJob_Size>>1))
//status save buf
#define K_DPS_ADDR_DeviceStatus 		(K_DPS_ADDR_ConfigPrintInfo +  (K_DPS_ADDR_ConfigPrintInfo_Size>>1))
#define K_DPS_ADDR_JobStatus 			(K_DPS_ADDR_DeviceStatus + ( K_DPS_ADDR_DeviceStatus_Size>>1))

#define K_DPS_ADDR_ConfigPrintService 	(K_DPS_ADDR_JobStatus +  (K_DPS_ADDR_JobStatus_Size>>1))

#define K_DPS_ADDR_Capatility 			(K_DPS_ADDR_ConfigPrintService + K_DPS_ADDR_ConfigPrintService_Size)

#define K_DPS_ADDR_Capatility_Qualities			(K_DPS_ADDR_Capatility)
#define K_DPS_ADDR_Capatility_PaperSizes		(K_DPS_ADDR_Capatility_Qualities 		+ (K_DPS_ADDR_Capatility_Item_Size>>1))
#define K_DPS_ADDR_Capatility_PaperTypes		(K_DPS_ADDR_Capatility_PaperSizes 		+ (K_DPS_ADDR_Capatility_Item_Size>>1))
#define K_DPS_ADDR_Capatility_FileTypes			(K_DPS_ADDR_Capatility_PaperTypes		+ (K_DPS_ADDR_Capatility_Item_Size>>1))
#define K_DPS_ADDR_Capatility_DatePrints			(K_DPS_ADDR_Capatility_FileTypes		+ (K_DPS_ADDR_Capatility_Item_Size>>1))
#define K_DPS_ADDR_Capatility_FileNamePrints	(K_DPS_ADDR_Capatility_DatePrints		+ (K_DPS_ADDR_Capatility_Item_Size>>1))
#define K_DPS_ADDR_Capatility_ImageOptimizes	(K_DPS_ADDR_Capatility_FileNamePrints	+ (K_DPS_ADDR_Capatility_Item_Size>>1))
#define K_DPS_ADDR_Capatility_Layouts			(K_DPS_ADDR_Capatility_ImageOptimizes	+ (K_DPS_ADDR_Capatility_Item_Size>>1))
#define K_DPS_ADDR_Capatility_FixedSizes		(K_DPS_ADDR_Capatility_Layouts 		+ (K_DPS_ADDR_Capatility_Item_Size>>1))
#define K_DPS_ADDR_Capatility_Croppings			(K_DPS_ADDR_Capatility_FixedSizes 		+ (K_DPS_ADDR_Capatility_Item_Size>>1))

//#define K_DPS_ADDR_Capatility_ItemArrayStart 	(K_DPS_ADDR_Capatility 		+ (K_DPS_ADDR_Capatility_Size>>1))
//#define K_DPS_ADDR_Capatility_PaperTypesArray	K_DPS_ADDR_Capatility_ItemArrayStart
//#define K_DPS_ADDR_Capatility_LayoutsArray		(K_DPS_ADDR_Capatility_PaperTypesArray 		+ (K_DPS_ADDR_Capatility_ItemArray_Size>>1))

#define K_DPS_ADDR_StorSram0x1000					(K_DPS_ADDR_Capatility+ (K_DPS_ADDR_Capatility_Size>>1))
//////////////////////////////
//temp dram buf
#define K_DPS_ADDR_TempBuf			(K_DPS_ADDR_StorSram0x1000 + 512)

//SIDC usd temp buf
#define K_SDRAM_FreeAddr 				K_SDRAM_ImagePlaybackBufAddr


//io buf
#define dps_saveInDataContainer(pData)	SIDC_MAIN_SramToDram((UINT8 *)(pData), K_DPS_ADDR_InData_Container, K_DPS_ADDR_InData_Container_Size)
#define dps_saveInData(pData,index,size)	SIDC_MAIN_SramToDram((UINT8 *)(pData), K_DPS_ADDR_InData+(index>>1), size)
#define dps_saveOutData(pData,index,size)	SIDC_MAIN_SramToDram((UINT8 *)(pData),K_DPS_ADDR_OutData+(index>>1), size)
//file node buf
#define dps_saveFileNode(pData)	SIDC_MAIN_SramToDram((UINT8 *)(pData), K_DPS_ADDR_FileNode, K_DPS_ADDR_FileNode_Size)
//print set buf
#define dps_saveConfigStartJob(pData)	SIDC_MAIN_SramToDram((UINT8 *)(pData), K_DPS_ADDR_ConfigStartJob,K_DPS_ADDR_ConfigStartJob_Size)
#define dps_saveConfigStartJobItem(data,type)	SIDC_MAIN_SramToDram((UINT8 *)&(data), K_DPS_ADDR_ConfigStartJob+2*(type-DPS_ACTION_GetCapability),4)

#define dps_saveConfigPrintInfo(pData)	SIDC_MAIN_SramToDram((UINT8 *)(pData), K_DPS_ADDR_ConfigPrintInfo, K_DPS_ADDR_ConfigPrintInfo_Size)
#define dps_saveConfigPrintInfoCount(_count)	SIDC_MAIN_SramToDram((UINT8 *)&(_count), K_DPS_ADDR_ConfigPrintInfo, 2)
#define dps_saveConfigPrintInfoIndex(_index)	SIDC_MAIN_SramToDram((UINT8 *)&(_index), K_DPS_ADDR_ConfigPrintInfo + 1, 2)
#define dps_saveConfigPrintInfoItem(pData,_item)	SIDC_MAIN_SramToDram((UINT8 *)(pData), K_DPS_ADDR_ConfigPrintInfo + ((_item* DPS_PARA_ConfigPrintInfo_Size_Min +4)>>1), DPS_PARA_ConfigPrintInfo_Size_Min)

// getCapatility
#define dps_saveGetCapability_Item(dataType,pData)	SIDC_MAIN_SramToDram((UINT8 *)(pData), K_DPS_ADDR_Capatility + (((dataType-DPS_ACTION_GetCapability) *K_DPS_ADDR_Capatility_Item_Size)>>1), K_DPS_ADDR_Capatility_Item_Size) //dps_capabilityDataWriteOrRead(dataType,pData,0)
#define dps_saveGetCapability_Qualities(pData)	SIDC_MAIN_SramToDram((UINT8 *)(pData), K_DPS_ADDR_Capatility_Qualities, K_DPS_ADDR_Capatility_Item_Size)
#define dps_saveGetCapability_PaperSizes(pData)	SIDC_MAIN_SramToDram((UINT8 *)(pData), K_DPS_ADDR_Capatility_PaperSizes, K_DPS_ADDR_Capatility_Item_Size)
#define dps_saveGetCapability_PaperTypes(pData)	SIDC_MAIN_SramToDram((UINT8 *)(pData), K_DPS_ADDR_Capatility_PaperTypes, K_DPS_ADDR_Capatility_Item_Size)
#define dps_saveGetCapability_FileTypes(pData)	SIDC_MAIN_SramToDram((UINT8 *)(pData), K_DPS_ADDR_Capatility_FileTypes, K_DPS_ADDR_Capatility_Item_Size)
#define dps_saveGetCapability_DatePrints(pData)	SIDC_MAIN_SramToDram((UINT8 *)(pData), K_DPS_ADDR_Capatility_DatePrints, K_DPS_ADDR_Capatility_Item_Size)
#define dps_saveGetCapability_FileNamePrints(pData)	SIDC_MAIN_SramToDram((UINT8 *)(pData), K_DPS_ADDR_Capatility_FileNamePrints, K_DPS_ADDR_Capatility_Item_Size)
#define dps_saveGetCapability_ImageOptimizes(pData)	SIDC_MAIN_SramToDram((UINT8 *)(pData), K_DPS_ADDR_Capatility_ImageOptimizes, K_DPS_ADDR_Capatility_Item_Size)
#define dps_saveGetCapability_Layouts(pData)			SIDC_MAIN_SramToDram((UINT8 *)(pData), K_DPS_ADDR_Capatility_Layouts, K_DPS_ADDR_Capatility_Item_Size)
#define dps_saveGetCapability_FixedSizes(pData)		SIDC_MAIN_SramToDram((UINT8 *)(pData), K_DPS_ADDR_Capatility_FixedSizes, K_DPS_ADDR_Capatility_Item_Size)
#define dps_saveGetCapability_Croppings(pData)		SIDC_MAIN_SramToDram((UINT8 *)(pData), K_DPS_ADDR_Capatility_Croppings, K_DPS_ADDR_Capatility_Item_Size)

//#define dps_saveGetCapability_PaperTypesArrayCount(_count)	SIDC_MAIN_SramToDram((UINT8 *)&_count, K_DPS_ADDR_Capatility_PaperTypesArray,2)
//#define dps_saveGetCapability_PaperTypesArray(index,pData)	SIDC_MAIN_SramToDram(pData, K_DPS_ADDR_Capatility_PaperTypesArray+1 + ((K_DPS_ADDR_Capatility_Item_Size*index)>>1), K_DPS_ADDR_Capatility_ItemArray_Size)
//#define dps_saveGetCapability_LayoutsArray(index,pData)	SIDC_MAIN_SramToDram(pData, K_DPS_ADDR_Capatility_LayoutsArray+1 + ((K_DPS_ADDR_Capatility_Item_Size*index)>>1), K_DPS_ADDR_Capatility_ItemArray_Size)
// Notify/get status
#define dps_saveDeviceStatus(pData)		SIDC_MAIN_SramToDram((UINT8 *)(pData), K_DPS_ADDR_DeviceStatus, DPS_PARA_DeviceStatus_Size)
#define dps_saveJobStatus(pData)			SIDC_MAIN_SramToDram((UINT8 *)(pData), K_DPS_ADDR_JobStatus, DPS_PARA_JobStatus_Size)

//sram storage
#define dps_saveGucStorData()			SIDC_MAIN_SramToDram(G_ucStorData, K_DPS_ADDR_StorSram0x1000, 1024)
#define dps_saveGucStorData_intr()		SIDC_FUNC_SramToDram(G_ucStorData, K_DPS_ADDR_StorSram0x1000, 1024)

//configure service
#define dps_saveConfigService(pData)			SIDC_MAIN_SramToDram((UINT8 *)(pData), K_DPS_ADDR_ConfigPrintService, K_DPS_ADDR_ConfigPrintService_Size)

//io buf
#define dps_loadInDataContainer(pData)	SIDC_MAIN_DramToSram((UINT8 *)(pData), K_DPS_ADDR_InData_Container, K_DPS_ADDR_InData_Container_Size)
#define dps_loadInData(pData,index,size)	SIDC_MAIN_DramToSram((UINT8 *)(pData), K_DPS_ADDR_InData+(index>>1), size)
#define dps_loadOutData(pData,index,size)	SIDC_MAIN_DramToSram((UINT8 *)(pData), K_DPS_ADDR_OutData+(index>>1), size)
//file node buf
#define dps_loadFileNode(pData)	SIDC_MAIN_DramToSram((UINT8 *)(pData), K_DPS_ADDR_FileNode, K_DPS_ADDR_FileNode_Size)
//print set buf
#define dps_loadConfigStartJob(pData)	SIDC_MAIN_DramToSram((UINT8 *)(pData), K_DPS_ADDR_ConfigStartJob,K_DPS_ADDR_ConfigStartJob_Size)
#define dps_loadConfigStartJobItem(data,type)	SIDC_MAIN_DramToSram((UINT8*)&(data), K_DPS_ADDR_ConfigStartJob+2*(type-DPS_ACTION_GetCapability),4)
#define dps_loadConfigPrintInfo(pData)	SIDC_MAIN_DramToSram((UINT8 *)(pData), K_DPS_ADDR_ConfigPrintInfo, K_DPS_ADDR_ConfigPrintInfo_Size)
#define dps_loadConfigPrintInfoCount(_count)	SIDC_MAIN_DramToSram((UINT8 *)&(_count), K_DPS_ADDR_ConfigPrintInfo, 2)
#define dps_loadConfigPrintInfoIndex(_index)	SIDC_MAIN_DramToSram((UINT8 *)&(_index), K_DPS_ADDR_ConfigPrintInfo + 1, 2)
#define dps_loadConfigPrintInfoItem(pData,_item)	SIDC_MAIN_DramToSram((UINT8 *)(pData), K_DPS_ADDR_ConfigPrintInfo + ((_item* DPS_PARA_ConfigPrintInfo_Size_Min +4)>>1), DPS_PARA_ConfigPrintInfo_Size_Min)
#define dps_clearConfigPrintInfo() halDramFill(K_DPS_ADDR_ConfigPrintInfo, K_DPS_ADDR_ConfigPrintInfo_Size, 0)


#define dps_loadGetCapability_Item(dataType,pData)	SIDC_MAIN_DramToSram((UINT8 *)(pData), K_DPS_ADDR_Capatility +(( (dataType-DPS_ACTION_GetCapability) *K_DPS_ADDR_Capatility_Item_Size)>>1), K_DPS_ADDR_Capatility_Item_Size) //dps_capabilityDataWriteOrRead(dataType,pData,1)
#define dps_loadGetCapability_Qualities(pData)		SIDC_MAIN_DramToSram((UINT8 *)(pData), K_DPS_ADDR_Capatility_Qualities, K_DPS_ADDR_Capatility_Item_Size)
#define dps_loadGetCapability_PaperSizes(pData)	SIDC_MAIN_DramToSram((UINT8 *)(pData), K_DPS_ADDR_Capatility_PaperSizes, K_DPS_ADDR_Capatility_Item_Size)
#define dps_loadGetCapability_PaperTypes(pData)	SIDC_MAIN_DramToSram((UINT8 *)(pData), K_DPS_ADDR_Capatility_PaperTypes, K_DPS_ADDR_Capatility_Item_Size)
#define dps_loadGetCapability_FileTypes(pData)	SIDC_MAIN_DramToSram((UINT8 *)(pData), K_DPS_ADDR_Capatility_FileTypes, K_DPS_ADDR_Capatility_Item_Size)
#define dps_loadGetCapability_DatePrints(pData)	SIDC_MAIN_DramToSram((UINT8 *)(pData), K_DPS_ADDR_Capatility_DatePrints, K_DPS_ADDR_Capatility_Item_Size)
#define dps_loadGetCapability_FileNamePrints(pData)	SIDC_MAIN_DramToSram((UINT8 *)(pData), K_DPS_ADDR_Capatility_FileNamePrints, K_DPS_ADDR_Capatility_Item_Size)
#define dps_loadGetCapability_ImageOptimizes(pData)	SIDC_MAIN_DramToSram((UINT8 *)(pData), K_DPS_ADDR_Capatility_ImageOptimizes, K_DPS_ADDR_Capatility_Item_Size)
#define dps_loadGetCapability_Layouts(pData)			SIDC_MAIN_DramToSram((UINT8 *)(pData), K_DPS_ADDR_Capatility_Layouts, K_DPS_ADDR_Capatility_Item_Size)
#define dps_loadGetCapability_FixedSizes(pData)		SIDC_MAIN_DramToSram((UINT8 *)(pData, K_DPS_ADDR_Capatility_FixedSizes, K_DPS_ADDR_Capatility_Item_Size)
#define dps_loadGetCapability_Croppings(pData)		SIDC_MAIN_DramToSram((UINT8 *)(pData), K_DPS_ADDR_Capatility_Croppings, K_DPS_ADDR_Capatility_Item_Size)

//#define dps_loadGetCapability_PaperTypesArrayCount(_count)	SIDC_MAIN_DramToSram((UINT8 *)&_count, K_DPS_ADDR_Capatility_PaperTypesArray,2)
//#define dps_loadGetCapability_PaperTypesArray(index,pData)	SIDC_MAIN_DramToSram(pData, K_DPS_ADDR_Capatility_PaperTypesArray+1+ ((K_DPS_ADDR_Capatility_Item_Size*index)>>1), K_DPS_ADDR_Capatility_ItemArray_Size)
//#define dps_loadGetCapability_LayoutsArray(index,pData)		SIDC_MAIN_DramToSram(pData, K_DPS_ADDR_Capatility_LayoutsArray+1 + ((K_DPS_ADDR_Capatility_Item_Size*index)>>1), K_DPS_ADDR_Capatility_ItemArray_Size)

#define dps_loadDeviceStatus(pData)		SIDC_MAIN_DramToSram((UINT8 *)(pData), K_DPS_ADDR_DeviceStatus, K_DPS_ADDR_DeviceStatus_Size)
#define dps_loadJobStatus(pData)			SIDC_MAIN_DramToSram((UINT8 *)(pData), K_DPS_ADDR_JobStatus, K_DPS_ADDR_JobStatus_Size)

//sram storage
#define dps_loadGucStorData()			SIDC_MAIN_DramToSram(G_ucStorData, K_DPS_ADDR_StorSram0x1000, 1024)
#define dps_loadGucStorData_intr()		SIDC_FUNC_DramToSram(G_ucStorData, K_DPS_ADDR_StorSram0x1000, 1024)
//configure service

#define dps_loadConfigService(pData)			SIDC_MAIN_DramToSram((UINT8 *)(pData), K_DPS_ADDR_ConfigPrintService, K_DPS_ADDR_ConfigPrintService_Size)



#endif
